﻿using System;
using System.Windows.Forms;
using Sims3Package.Wrapper;
using System.IO;

namespace PackageEditor.Helper
{
    public partial class TextHelper : Form
    {

        public TextResourceWrapper w;

        public TextHelper(Stream s)
        {
            InitializeComponent();
            w = new TextResourceWrapper(s);
        }

        private void TextHelper_Load(object sender, EventArgs e)
        {
            this.textBox.Text = w.Text;
            this.textBox.Select(0, 0);
            this.Icon = Properties.Resources.Icon;
        }

        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            w.Text = this.textBox.Text;
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }

        private void copyAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Clipboard.SetText(this.textBox.Text);
        }

        private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Clipboard.ContainsText())
                this.textBox.Text = Clipboard.GetText();
        }

        private void discardToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }
    }
}
